﻿status = -1;
var itemList = Array(
// ------ 银河副手 ------
Array(1352296, 500, 1, 3), //银河之灵符0
Array(1353006, 500, 1, 3), //银河之控制器0
Array(1352286, 500, 1, 3), //银河之剑鞘0
Array(1352815, 500, 1, 3), //银河之私语0
Array(1099012, 300, 1, 3), //银河之盾0
Array(1352935, 500, 1, 3), //银河之天龙锤0
Array(1352276, 500, 1, 3), //银河之扳指0
Array(1352506, 500, 1, 3), //银河之精髓0
Array(1342095, 500, 1, 3), //银河之刃0
Array(1352606, 500, 1, 3), //银河之灵魂手镯0
Array(1352916, 500, 1, 3), //银河之鹰眼0
Array(1352256, 500, 1, 3), //银河之白金之书0
Array(1352406, 500, 1, 3), //银河之魂珠0
Array(1352906, 500, 1, 3), //银河之腕轮0
Array(1352236, 500, 1, 3), //银河之赤铜之书0
Array(1353105, 500, 1, 3), //银河之狐狸珠0
Array(1352226, 500, 1, 3), //银河之锁链0
Array(1352967, 500, 1, 3), //银河之狂野之矛0
Array(1352606, 500, 1, 3), //银河之灵魂手镯
Array(1352206, 500, 1, 3), //银河之吊坠
Array(1352216, 500, 1, 3), //银河之念珠
Array(1352928, 500, 1, 3), //银河之火药桶0
Array(1352808, 500, 1, 3), //黑色刀0
Array(1352957, 500, 1, 3), //银河之极限球
Array(1352266, 500, 1, 3), //银河之风暴羽毛
Array(1352945, 500, 1, 3), //银河之龙神的遗产
Array(1352109, 500, 1, 3), //银河之卡片0
Array(1099011, 500, 1, 3), //银河之咒盾0
Array(1352975, 500, 1, 3), //银河之圣地之光0
Array(1352707, 500, 1, 3), //银河之麦林弹0
Array(1352246, 500, 1, 3), //银河之青银之书0
Array(1352009, 500, 1, 3), //银河之箭矢0
Array(4000463, 500, 1, 3)  //是国庆纪念币。
);

function start() {
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == 1) {
        status++;
    } else {
        if (status == 0) {
            im.sendOk("不想使用吗？…我的肚子里有各类#b奇特座椅或卷轴、装备、新奇道具#k哦！");
            im.dispose();
        }
        status--;
    }
    if (status == 0) {
        var chance = Math.floor(Math.random() * 500);
        var finalitem = Array();
        for (var i = 0; i < itemList.length; i++) {
            if (itemList[i][1] >= chance) {
                finalitem.push(itemList[i]);
            }
        }
        if (finalitem.length != 0) {
            var item;
            var random = new java.util.Random();
            var finalchance = random.nextInt(finalitem.length);
            var itemId = finalitem[finalchance][0];
            var quantity = finalitem[finalchance][2];
            var notice = finalitem[finalchance][3];
            item = im.gainGachaponItem(itemId, quantity, "银河副手", notice);
            if (item != -1) {
		im.gainItem(2433028, -1);
                im.sendOk("你获得了 #b#t" + item + "##k " + quantity + "个。");
            } else {
                im.sendOk("请你确认在背包的装备，消耗，其他窗口中是否有一格以上的空间。");
            }
            im.safeDispose();
        } else {
            im.sendOk("今天的运气可真差，什么都没有拿到。");
            im.safeDispose();
        }
    }
}